package com.gxuwz.leaveSystem.service;


import com.gxuwz.leaveSystem.dao.StudentDao;
import com.gxuwz.leaveSystem.entity.Student;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class StudentService {
    private StudentDao studentDao;

    public void setStudentDao(StudentDao studentDao) {
        this.studentDao = studentDao;
    }

    /**
     * 添加学生
     * @param student
     * @return
     */
    public int addStudent(Student student) {
        return studentDao.addStudent(student);
    }

    /**
     * 修改学生
     * @param student
     * @return
     */
    public int updateStudent(Student student) {
        return studentDao.updateStudent(student);
    }

    /**
     * 删除学生
     * @param id
     * @return
     */
    public int deleteStudent(String id) {
        return studentDao.deleteStudent(id);
    }

    /**
     * 根据id查询学生
     * @param id
     * @return
     */
    public Student getStudent(String id) {
        return studentDao.getStudent(id);
    }

    /**
     * 查询所有学生
     * @return
     */
    public List<Student> getAllStudents() {
        return studentDao.getAllStudents();
    }

    /**
     * 根据关键字搜索
     * @param keyword
     * @return
     */
    public List<Student> searchStudent(String keyword){
        return studentDao.searchStudent(keyword);
    }
}
